Skip to content

[SYCL][NFC] Make kernel_impl::getAdapter() return by reference #19313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2025

Conversation

uditagarwal97
Copy link
Contributor

@uditagarwal97 uditagarwal97 commented Jul 4, 2025

It's a part of larger refactoring effort to pass adapter via reference instead of pointer everywhere in the codebase.

Follow-up of:
#19186
#19184
#19187
#19202
#19299
#19312

@uditagarwal97 uditagarwal97 self-assigned this Jul 4, 2025
@uditagarwal97 uditagarwal97 changed the title [SYCL][NFC] Make kernel_impl::getAdapter() return by reference [SYCL][NFC] Make kernel_impl::getAdapter() return by reference Jul 4, 2025
@uditagarwal97 uditagarwal97 force-pushed the private/udit/adapterref7 branch from 091d314 to ddfba84 Compare July 7, 2025 16:50
@uditagarwal97 uditagarwal97 marked this pull request as ready for review July 7, 2025 16:51
@uditagarwal97 uditagarwal97 requested a review from a team as a code owner July 7, 2025 16:51
@uditagarwal97 uditagarwal97 marked this pull request as draft July 7, 2025 16:57
@uditagarwal97 uditagarwal97 force-pushed the private/udit/adapterref7 branch from ddfba84 to f8e59fe Compare July 7, 2025 17:45
@uditagarwal97 uditagarwal97 marked this pull request as ready for review July 7, 2025 17:45
Copy link
Contributor

@maarquitos14 maarquitos14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just the one question that is kind of general.

@@ -469,7 +469,7 @@ void handleErrorOrWarning(ur_result_t Error, const device_impl &DeviceImpl,

namespace detail::kernel_get_group_info {
void handleErrorOrWarning(ur_result_t Error, ur_kernel_group_info_t Descriptor,
const AdapterPtr &Adapter) {
adapter_impl &Adapter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to drop const?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, const was on shared_ptr<adapter_impl> and not the adapter_impl object itself. Ensuring const-correctness on adapter_impl object throughout the code would be orthogonal to the refactoring work that I'm doing and it's not trivial (I tried that before). So, for uniformity, throughout the refactoring, I've replaced const AdapterPtr with adapter_impl.
With that said, for the handleErrorOrWarning function specifically, since adapter_impl object is not passed around anywhere, I can add const adapter_impl& if that's desirable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uniformity is fine with me. Thanks for the explanation!

@@ -31,8 +31,7 @@ void handleErrorOrWarning(ur_result_t, const device_impl &, ur_kernel_handle_t,

namespace kernel_get_group_info {
/// Analyzes error code of urKernelGetGroupInfo.
void handleErrorOrWarning(ur_result_t, ur_kernel_group_info_t,
const AdapterPtr &);
void handleErrorOrWarning(ur_result_t, ur_kernel_group_info_t, adapter_impl &);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question again.

@uditagarwal97
Copy link
Contributor Author

********************
Timed Out Tests (1):
  SYCL :: GroupAlgorithm/root_group.cpp


Testing Time: 380.23s

Total Discovered Tests: 2443
  Excluded         :  584 (23.91%)
  Unsupported      :  572 (23.41%)
  Passed           : 1282 (52.48%)
  Expectedly Failed:    4 (0.16%)
  Timed Out        :    1 (0.04%)

GroupAlgorithm/root_group.cpp failure is unrelated and tracked in #14747

@uditagarwal97 uditagarwal97 merged commit 3f0530c into sycl Jul 8, 2025
23 of 24 checks passed
@uditagarwal97 uditagarwal97 deleted the private/udit/adapterref7 branch July 8, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants